<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--替换标签体-->
<p th:text="处理后内容">未处理内容</p>

<h3>替换属性值</h3>
<input type="text" value="aaa" th:value="bbbb"><br/>

<h3>访问属性域</h3>
<p th:text="${attrNameRequestScope}">访问请求域1</p><br/>
<p th:text="${#httpServletRequest.getAttribute('attrNameRequestScope')}">访问请求域2</p><br/>
<p th:text="${session.attrNameSessionScope}">会话域</p><br/>
<p th:text="${#servletContext.getAttribute('attrNameAppScope')}">应用域</p><br/>

<h3>解析URL地址</h3>

<!--获取contextPath值 http://localhost:8080/atguigu/test/thymeleaf-->
<p th:text="@{/aaa/bbb/cc}">contextPath的值附加到指定的地址前</p>
<a href="../aaa/bbb/ccc.html" th:href="@{/aaa/bbb/cc.html}">使用场景</a>

<h3>直接表达式</h3>
有转义效果<p>[[${attrNameRequestScope}]]</p>
无转义效果<p>[(${attrNameRequestScope})]</p>

<h3>判断字符串是否为空</h3>
<p th:if="${not #strings.isEmpty(attrNameRequestScope)}">不为空输出</p>
-<p th:if="${#strings.isEmpty(attrNameRequestScope)}">为空输出</p>-

<h3>测试遍历</h3>
<table style="align-content: center;border: black" >
    <tr>
        <th>id</th>
        <th>序号</th>
        <th>名称</th>
        <th>邮箱</th>
        <th>创建时间</th>
    </tr>
    <tr th:each="admin : ${adminList}">
       <td style="width: 30px" th:text="${admin.getId()}"></td>
       <td style="width: 90px" th:text="${admin.getLoginAcct()}"></td>
       <td style="width: 120px" th:text="${admin.getUserName()}"></td>
       <td style="width: 120px" th:text="${admin.getEmail()}"></td>
       <td style="width: 300px" th:text="${admin.getCreateTime()}"></td>
    </tr>
</table>


<h3>包含片段</h3>
<div style="background-color: bisque" th:insert="~{include/part :: myFirstPart}"></div>
<div style="background-color: yellow" th:replace="~{include/part :: mySecondPart}"></div>
<div style="background-color: pink" th:include="~{include/part :: myThreePart}"></div>
</body>
</html>